package com.esri.android.action;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.AsyncTask;
import android.widget.HorizontalScrollView;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import com.esri.core.tasks.identify.IdentifyResult;
import java.util.List;

/* loaded from: classes.dex */
public class IdentifyResultSpinner extends Spinner {
    public IdentifyResultSpinner(Context context, List<IdentifyResult> list) {
        super(context);
        setPrompt("Results List");
        setAdapter((SpinnerAdapter) new IdentifyResultSpinnerAdapter(context, list));
    }

    @Override // android.widget.Spinner, android.content.DialogInterface.OnClickListener
    public void onClick(DialogInterface dialogInterface, int i) {
        new a().execute(new Integer(i));
    }

    /* loaded from: classes.dex */
    private class a extends AsyncTask<Integer, Void, Void> {
        AlertDialog a;
        AlertDialog b;
        ScrollView c;
        Integer d;

        private a() {
        }

        /* JADX INFO: Access modifiers changed from: protected */
        @Override // android.os.AsyncTask
        /* renamed from: a */
        public void onPostExecute(Void r1) {
            this.b.show();
            this.a.dismiss();
        }

        /* JADX INFO: Access modifiers changed from: protected */
        @Override // android.os.AsyncTask
        /* renamed from: a */
        public Void doInBackground(Integer... numArr) {
            this.d = numArr[0];
            this.c = new ScrollView(IdentifyResultSpinner.this.getContext());
            HorizontalScrollView horizontalScrollView = new HorizontalScrollView(IdentifyResultSpinner.this.getContext());
            horizontalScrollView.addView(new IdentifyResultView(IdentifyResultSpinner.this.getContext(), ((IdentifyResultSpinnerAdapter) IdentifyResultSpinner.this.getAdapter()).a.get(this.d.intValue())));
            this.c.addView(horizontalScrollView);
            this.b.setView(this.c);
            return null;
        }

        @Override // android.os.AsyncTask
        protected void onPreExecute() {
            AlertDialog.Builder builder = new AlertDialog.Builder(IdentifyResultSpinner.this.getContext());
            builder.setTitle("Details");
            this.a = builder.create();
            TextView textView = new TextView(IdentifyResultSpinner.this.getContext());
            textView.setText("Loading details...");
            this.a.setView(textView);
            this.a.show();
            AlertDialog.Builder builder2 = new AlertDialog.Builder(IdentifyResultSpinner.this.getContext());
            builder2.setTitle("Details");
            this.b = builder2.create();
        }
    }
}
